#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <strings.h>

int main(int argc, char **argv)
{
	fd_set fread_set;
	int ret;
	char buf[20];
	struct timeval tw = {5,0};

        bzero(buf, 20);
	FD_ZERO(&fread_set);
	FD_SET(STDIN_FILENO, &fread_set);
	ret = select(STDIN_FILENO+1, &fread_set, NULL, NULL, &tw);
	
	if (ret == -1) {
	        perror("err\r\n");
	} else {
	        if(FD_ISSET(STDIN_FILENO, &fread_set)) {
	                read(STDIN_FILENO, buf, 20);
	                printf("yes: %s\r\n", buf);
	        }
	}

        return 10;

	
}
